package com.project.controller;

import com.project.bean.StudentBean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("user")
public class UserController {
    @RequestMapping("checkName")
    public String checkName(String userName){
        if ("java".equals(userName)){
            return "ok";
        }else {
            return "no";
        }
    }
    @RequestMapping("getList")
    public List<StudentBean> getList(){
        List<StudentBean> list = new ArrayList<>();
        list.add(new StudentBean("陈",1, LocalDate.parse("1997-05-03")));
        list.add(new StudentBean("曾哥",2, LocalDate.parse("2005-05-03")));
        list.add(new StudentBean("雪静",3, LocalDate.parse("1998-05-03")));
        list.add(new StudentBean("涛哥",4, LocalDate.parse("2000-05-03")));
        list.add(new StudentBean("诚哥",5, LocalDate.parse("2000-01-03")));
        return list;
    }
}
